<!DOCTYPE html>
<html>
  <head>
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%= favicon_link_tag 'roroacms/admin/favicon.ico' %>
    <title><%= t("views.admin.layouts.admin.meta_title") %></title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

    <!-- Fonts -->
    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,900,300italic,400italic,600italic,700italic,900italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">

    <%= stylesheet_link_tag "roroacms/admin/application", :media => "all" %>
    <%= stylesheet_link_tag "roroacms/roroacms", :media => "all" if application_admin_file_exists?('roroacms', 'css') %>
    <%= javascript_include_tag 'roroacms/admin/application' %>
    <%= javascript_include_tag 'roroacms/roroacms', :media => 'all' if application_admin_file_exists?('roroacms', 'js') %>

    <%= csrf_meta_tags %>
  </head>
  <body>
      <div class="js-settings" data-pagination-limit="<%= Roroacms::Setting.get('pagination_per') %>" data-site-url="<%= site_url %>" data-tour-taken="<%= Roroacms::Setting.get('tour_taken') %>"></div>
    <section id="container">
      <% cache('admin_header') do %>
        <header id="header">
            <!--logo start-->
            <div class="brand">
            </div>
            <!--logo end-->
            <div class="toggle-navigation toggle-left">
                <button type="button" class="btn btn-default" id="toggle-left">
                    <i class="fa fa-bars"></i>
                </button>
            </div>

            <div class="user-nav">
                <ul>
                    <li class="profile-photo">
                        <%= link_to roroacms.edit_admin_administrator_path(session[:admin_id]) do %>
                        <% end %>
                    </li>
                </ul>
            </div>
          </header>
        <% end %>
        <!--sidebar left start-->
          <aside class="sidebar <%= !cookies[:header_menu_contracted].blank? ? 'sidebar-toggle manual' : '' %>">
            <div id="leftside-navigation" class="nano">
                <ul class="nano-content">
                    <li class="<%= cp(roroacms.admin_path) %>">
                      <%= link_to roroacms.admin_path do %>
                        <i class="fa fa-dashboard"></i><span><%= t("generic.dashboard") %></span>
                      <% end %>
                    </li>
                    <% if check_controller_against_user('pages') || check_controller_against_user('articles') || check_controller_against_user('terms') || request.url.include?('terms') %>
                      <li id="dashboardContent" class="sub-menu <%= cp(roroacms.admin_pages_path) %> <%= cp(roroacms.new_admin_page_path) %> <%= cp(roroacms.admin_articles_path) %> <%= cp(roroacms.new_admin_article_path) %> <%= cp(roroacms.admin_article_categories_path) %> <%= cp(roroacms.admin_article_tags_path) %> <%= cp('', true) %>">
                          <a href="javascript:;">
                            <i class="fa fa-file"></i><span><%= t("views.admin.generic.content") %></span>
                            <i class="arrow fa fa-angle-right pull-right"></i>
                          </a>
                          <ul>
                            <% if check_controller_against_user('pages') %>
                              <li class="<%= cp(roroacms.admin_pages_path) %>"><%= link_to t("generic.pages"), roroacms.admin_pages_path %></li>
                              <li class="<%= cp(roroacms.new_admin_page_path) %>"><%= link_to t("views.admin.layouts.admin.navigation.add_new_page"), roroacms.new_admin_page_path %></li>
                            <% end %>
                            <li class="divider"></li>
                            <% if check_controller_against_user('articles') %>
                              <li class="<%= cp(roroacms.admin_articles_path) %>"><%= link_to t("generic.articles"), roroacms.admin_articles_path %></li>
                              <li class="<%= cp(roroacms.new_admin_article_path) %>"><%= link_to t("views.admin.layouts.admin.navigation.add_new_article"), roroacms.new_admin_article_path %></li>
                            <% end %>
                            <% if check_controller_against_user('terms') %>
                              <li class="<%= cp(roroacms.admin_article_categories_path) %>"><%= link_to t("generic.categories"), roroacms.admin_article_categories_path %></li>
                              <li class="<%= cp(roroacms.admin_article_tags_path) %>"><%= link_to t("generic.tags"), roroacms.admin_article_tags_path %></li>
                            <% end %>
                          </ul>
                      </li>
                    <% end %>
                    <li class="sub-menu <%= cp(roroacms.admin_administrators_path) %> <%= cp(roroacms.edit_admin_administrator_path(session[:admin_id])) %> <%= cp(roroacms.new_admin_administrator_path) %>">
                        <a href="javascript:;">
                          <i class="fa fa-user"></i><span><%= t("generic.users") %></span>
                          <i class="arrow fa fa-angle-right pull-right"></i>
                        </a>
                        <ul>
                          <li class="<%= cp(roroacms.edit_admin_administrator_path(session[:admin_id])) %>"><%= link_to t("generic.profile"), roroacms.edit_admin_administrator_path(session[:admin_id]) %></li>
                          <% if check_controller_against_user('administrators') %>
                              <li class="<%= cp(roroacms.admin_administrators_path) %>"><%= link_to t("generic.users"), roroacms.admin_administrators_path %></li>
                              <li class="<%= cp(roroacms.new_admin_administrator_path) %>"><%= link_to t("generic.add_new_user"), roroacms.new_admin_administrator_path %></li>
                          <% end %>
                        </ul>
                    </li>

                    <% if check_controller_against_user('menus') %>
                      <li id="dashboardMenus"  class="<%= cp(roroacms.admin_menus_path) %>">
                        <%= link_to roroacms.admin_menus_path do %>
                          <i class="fa fa-list"></i><span><%= t("generic.menus") %></span>
                        <% end %>
                      </li>
                    <% end %>
                    <% if (Roroacms::Setting.get('article_comment_type') == 'R' && Roroacms::Setting.get('article_comments') == 'Y') && check_controller_against_user('comments') %>
                       <li id="dashboardComments" class="<%= cp(roroacms.admin_comments_path) %>">
                        <%= link_to roroacms.admin_comments_path do %>
                          <i class="fa fa-comments"></i><span><%= t("generic.comments") %></span>
                        <% end %>
                      </li>
                    <% end %>

                    <% if check_controller_against_user('themes') %>
                      <li id="dashboardThemes" class="<%= cp(roroacms.admin_themes_path) %>">
                        <%= link_to roroacms.admin_themes_path do %>
                          <i class="fa fa-flask"></i><span><%= t("generic.themes") %></span>
                        <% end %>
                      </li>
                    <% end %>
                    
                    <% if check_controller_against_user('settings') %>

                      <li id="dashboardSettings" class="<%= cp(roroacms.admin_settings_path) %>">
                        <%= link_to roroacms.admin_settings_path do %>
                          <i class="fa fa-cogs"></i><span><%= t("generic.settings") %></span>
                        <% end %>
                      </li>

                    <% end %>

                    <% if check_controller_against_user('trash') %>

                        <li class="<%= cp(roroacms.admin_trash_index_path) %>">
                          <%= link_to roroacms.admin_trash_path do %>
                            <i class="fa fa-trash-o"></i><span><%= t("generic.trash") %></span>
                          <% end %>
                        </li>
                      
                    <% end %>

                    <%= append_application_menu %>

                    <li>
                      <%= link_to roroacms.destroy_admin_session_path do %>
                        <i class="fa fa-power-off"></i><span><%= t("views.admin.layouts.admin.navigation.logout") %></span>
                      <% end %>
                    </li>

                </ul>
            </div>
          </aside>


        <section class="main-content-wrapper <%= !cookies[:header_menu_contracted].blank? ? 'main-content-toggle-left manual' : '' %>">
            <section id="main-content">
                <%= theme_exists %>
                <% if !current_page?(roroacms.admin_path) %>
                  <div class="row">
                      <div class="col-md-12">
                         <%= render_breadcrumb %>
                         <h1 class="h1"><%= defined?(@title) ? @title : 'No Title' %></h1>
                         <div class="clearfix"></div>
                         <div class="alert-wrapper"><%= get_notifications %></div>
                      </div>
                  </div>
                <% else %>
                  <div class="alert-wrapper"><%= get_notifications %></div>
                <% end %>

                <%= yield %>
               
            </section>
        </section>
    </section>
  </body>
</html>